<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function delay() {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    console.log(22)
                    resolve()
                })
            })
        }
        //   let p = delay().then((res) => {
        //     console.log('555')
        //   })
        //   console.log('555')

        // async await的作用：可以让我们像写同步代码一样执行我们的异步代码
        async function xxx() {
            await delay()
            console.log('6666')
        }
        xxx()


        
    </script>
</body>

</html>